package com.qishi.exampleThree;

import com.qishi.exampleOne.ForumService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestIntroduce {

    public static void main(String[] args) {
        String configPath = "ddd.xml";
        ApplicationContext ctx = new ClassPathXmlApplicationContext(configPath);
        ForumService forumService = (ForumService)ctx.getBean("forumService");


        //执行业务逻辑 但是未开启监控
        forumService.removeForum(10);
        forumService.removeTopic(1023);

        //开启监控
        Monitorable monitorable = (Monitorable)forumService;
        monitorable.setMonitorActive(true);

        //执行业务逻辑
        forumService.removeForum(10);
        forumService.removeTopic(1023);
    }
}
